<template>
  <view>
    <u-navbar :background="{ background: '#fff' }" back-icon-color="#222222" title-color="#222222" title="患者评价" :border-bottom="false"></u-navbar>
    <view class="">
      <u-tabs :list="list" :is-scroll="false" :current="current" @change="change"></u-tabs>
    </view>
    <view class="" style="margin: 36rpx 28rpx; background: #fff; border-radius: 20rpx; padding-bottom: 55rpx" v-for="(i, k) in evellist" :key="k">
      <view class="">
        <view class="" style="display: flex; align-items: center; justify-content: space-between; padding: 39rpx 29rpx">
          <view class="" style="display: flex; align-items: center">
            <view class="" style="font-size: 30rpx">
              {{ i.username }}
            </view>
            <view class="">
              <u-rate :count="count" v-model="i.star" active-color="#FFB821" :disabled="true"></u-rate>
            </view>
          </view>
          <view class="" style="font-size: 26rpx; color: #666666">
            {{ i.create_time_text }}
          </view>
        </view>
        <view class="" style="font-size: 28rpx; padding: 0rpx 28rpx">
          <view class="">
            <text style="color: #666666">评价：</text>
            {{ i.content }}
          </view>
        </view>
      </view>
    </view>
    <view class="" style="height: 192rpx"></view>
    <!-- 底部栏 -->
    <view
      class=""
      style="
        width: 100%;
        height: 192rpx;
        background: #fff;
        box-shadow: 0px 0px 20rpx 0px rgba(0, 0, 0, 0.1);
        border-radius: 20rpx 20rpx 0px 0px;
        position: fixed;
        bottom: 0;
        display: flex;
        align-items: center;
        justify-content: space-around;
      "
    >
      <view class="" style="font-size: 26rpx; text-align: center" @tap="wen(1)">
        <image src="https://wenzhen.jiangkukeji360.com/static/index/wz.png" mode="" style="width: 60rpx; height: 60rpx"></image>
        <view class="">在线问诊</view>
      </view>
      <view class="" style="font-size: 26rpx; text-align: center" @tap="make">
        <image src="https://wenzhen.jiangkukeji360.com/static/index/yuyue.png" mode="" style="width: 60rpx; height: 60rpx"></image>
        <view class="">预约挂号</view>
      </view>
      <view class="" style="font-size: 26rpx; text-align: center" @tap="wen(2)">
        <image src="https://wenzhen.jiangkukeji360.com/static/index/tw.png" mode="" style="width: 60rpx; height: 60rpx"></image>
        <view class="">提问服务</view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      list: [
        {
          name: '好评'
        },
        {
          name: '中评'
        },
        {
          name: '差评'
        }
      ],
      current: 0,
      value: 2,
      count: 5,
      id: null,
      page: 1,
      evellist: []
    };
  },
  //方法
  methods: {
    wen(e) {
      uni.navigateTo({
        url: 'fwpay/fwpay/fwpay?id=' + this.id + '&type=' + e
      });
    },

    make() {
      uni.navigateTo({
        url: '/pages/index/calendar?id=' + this.id
      });
    },
    change(index) {
      this.current = index;
      this.page = 1;
      this.evellist = [];
      this.evel();
    },
    evel() {
      this.api({
        url: '/api/doctor/evaluate',
        method: 'post',
        data: {
          page: this.page,
          doctor_id: this.id,
          type: this.current + 1
        }
      }).then((res) => {
        this.evellist = this.evellist.concat(res.data);
        this.page++;
      });
    }
  },
  //首页渲染
  onLoad(options) {
    this.id = options.id;
    this.evel();
  }
};
</script>

<style lang="scss" scoped>
page {
  background: #f8f8f8;
}
</style>
